#!/usr/bin/env python
# -*- coding:utf-8 -*-

def md5(url):
    import hashlib
    try:
        m = hashlib.md5()  
        m.update(url)
        return m.hexdigest()
    except Exception, e:
        print url, e
        exit(0)

def testTrueUrl(url):
    import urllib2
    import spider_http
    print url
    opener = urllib2.build_opener()
    request = urllib2.Request(url = url, headers= spider_http.HEADER)
    request.get_method = lambda:'HEAD'
    try:
        reponse = opener.open(request)
        #return reponse.url
    except Exception, e:
        print 'testTrueUrl',e
        return None
        
    
if __name__ == '__main__':
    pass